<?php
/* +----------------------------------------------------------------------
 * 作	者: venus <venus-wxp@outlook.com>
 +----------------------------------------------------------------------
 * 创建日期: 2017/9/20 16:43
 +----------------------------------------------------------------------
 * 文件描述: 
 +----------------------------------------------------------------------
 * 升级记录: 
 +----------------------------------------------------------------------
 */

namespace app\base\validate;
use think\Validate;

class Base extends Validate {
    // 定义正则验证
    protected $regex = [
        // 匹配中文字符
        'onlyChinese' => '/[\u4e00-\u9fa5]/gm',
        // 匹配手机号
        'phone' => '/^(0|86|17951)?(13[0-9]|15[012356789]|17[3678]|18[0-9]|14[57])[0-9]{8}$/',
        // 匹配身份证号
        'idCard' => '/^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/',
        // 匹配邮政编码
        'postcode' => '/^[1-9]\d{5}(?!\d)$/',
        // 匹配菜单url
        'menuUrl' => '/^[a-z]\w*\/[a-z]\w*\/[a-z]\w*$/i'
    ];
}